const {
    Mysql
} = require('../tools/utils');
module.exports = async (ctx) => {
    let {
        title,
        vid
    } = ctx.query;
    if (title != 'undefined') {
        let sql = `SELECT * FROM video WHERE title LIKE '%${title}%'`
        try {
            let list = await Mysql(sql);
            ctx.state.data = {
                list
            };
        } catch (error) {};
        return;
    } else if (vid != 'undefined') {
        let sql = `SELECT * FROM video WHERE vid = ${Number(vid)}`;
        try {
            let list = await Mysql(sql);
            ctx.state.data = {
                list
            };
        } catch (error) {}
        return;
    }

}